const jwt=require("jsonwebtoken")
const auto=async(ctx,next)=>{
   const {authorization}=ctx.request.header
    console.log(authorization)
   if(authorization){
       const token=authorization.split(" ")[1]
       console.log(token)
       try{
           jwt.verify(token,"111")
           console.log(jwt.verify(token,"111"))
           await next()
       }catch(error){
           ctx.body={
               message:"校验失败"
           }
       }
   }else{
       ctx.body={
           message:"无token"
       }
   }
}
module.exports=auto